# Copyright 2024 Ant Group Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

load("@yacl//bazel:yacl.bzl", "yacl_cc_library", "yacl_cc_test")

package(default_visibility = ["//visibility:public"])

yacl_cc_library(
    name = "base",
    deps = [
        ":key_def",
        ":schema",
        ":serializable_types",
    ],
)

yacl_cc_library(
    name = "schema",
    srcs = ["schema.cc"],
    hdrs = ["schema.h"],
    deps = [
        "//heu/library/algorithms/dgk",
        "//heu/library/algorithms/dj",
        "//heu/library/algorithms/elgamal",
        "//heu/library/algorithms/mock",
        "//heu/library/algorithms/ou",
        "//heu/library/algorithms/paillier_clustar_fpga",
        "//heu/library/algorithms/paillier_float",
        "//heu/library/algorithms/paillier_gpu",
        "//heu/library/algorithms/paillier_ic",
        "//heu/library/algorithms/paillier_ipcl",
        "//heu/library/algorithms/paillier_zahlen",
    ],
)

yacl_cc_library(
    name = "serializable_types",
    srcs = [
        "plaintext.cc",
        "serializable_types.cc",
    ],
    hdrs = [
        "plaintext.h",
        "serializable_types.h",
    ],
    deps = [
        ":schema",
        ":variant_helper",
        "@com_github_msgpack_msgpack//:msgpack",
    ],
)

yacl_cc_library(
    name = "variant_helper",
    hdrs = [
        "predefined_functions.h",
        "variant_helper.h",
    ],
)

yacl_cc_library(
    name = "key_def",
    hdrs = ["key_def.h"],
    deps = [
        ":serializable_types",
    ],
)

test_suite(
    name = "phe_base_tests",
)

yacl_cc_test(
    name = "plaintext_test",
    srcs = ["plaintext_test.cc"],
    deps = [
        ":serializable_types",
    ],
)

yacl_cc_test(
    name = "schema_test",
    srcs = ["schema_test.cc"],
    deps = [
        ":schema",
        ":serializable_types",
    ],
)
